<?php 
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header');
?> 

<script language="javascript" type="text/javascript" src="<?php echo JS_PATH;?>commoncheck.js"></script>
<body onload="customercheck()">
<div class="txt_head_frame">
	<span class="txt_frame_title">修改客户信息</span>
</div>
<div id="main_content">
<form name="myform" action="?m=account&c=customermanage&a=edit" method="post" id="myform">
<input name="info[customer_id]" value="<?php echo $customer_id?>" type="hidden"/>
<input name="info[y_customer_name]" value="<?php echo $customer_name?>" type="hidden" id="y_customer_name"/>
<div class="txt_content_frame">
	<div class="txt_content_box">
		<div class="txt_content_left">
			<div class="txt_text_left">客户名称:<span>[*]</span></div>
			<div class="txt_left_input"><input name="info[customer_name]" type="text" class="txt" id="customer_name" value="<?php echo $customer_name?>"/></div><span id="validatecustomer_name" class="validate"></span><br/><br/>
            <div class="txt_text_left">热度:<span>[*]</span></div>
			<div class="txt_left_input">
            <select name="info[hotmemo]" class="select">
            <?php 
            	foreach ($option_cache['hotmemo']  as $key => $value) {
            ?>
			<option value="<?php echo $key?>" <?php echo $key == $hotmemo ? 'selected' : ''?>><?php echo $value?></option>
			<?php 
            	}
			?>
			</select>
			</div><br/><br/>
			<div class="txt_text_left">客户类型:<span>[*]</span></div>
			<div class="txt_left_input">
            <select name="info[customer_type]" class="select">
            <?php 
            	foreach ($option_cache['customer_type']  as $key => $value) {
            ?>
			<option value="<?php echo $key?>" <?php echo $key == $customer_type ? 'selected' : ''?>><?php echo $value?></option>
			<?php 
            	}
			?>
			</select>
			</div><br/><br/>
			<div class="txt_text_left">客户来源:<span>[*]</span></div>
			<div class="txt_left_input">
            <select name="info[customer_source]" class="select">
            <?php 
            	foreach ($option_cache['customer_source']  as $key => $value) {
            ?>
			<option value="<?php echo $key?>" <?php echo $key == $customer_source ? 'selected' : ''?>><?php echo $value?></option>
			<?php 
            	}
			?>
			</select>
			</div><br/><br/>   
			<div class="txt_text_left">地址:</div>
			<div class="txt_left_input"><input name="info[address]" type="text" class="txt" id="address" value="<?php echo $address?>"/></div><span id="validateaddress" class="validate"></span><br/><br/> 
			<div class="txt_text_left">联系电话:</div>
			<div class="txt_left_input"><input name="info[phone]" type="text" class="txt" id="phone" value="<?php echo $phone?>"/></div><span id="validatephone" class="validate"></span><br/><br/>
			<div class="txt_text_left">E-MAIL:</div>
			<div class="txt_left_input"><input name="info[email]" type="text" class="txt" id="email" value="<?php echo $email?>"/></div><span id="validateemail" class="validate"></span><br/><br/>  
			<div class="txt_text_left">网址:</div>
			<div class="txt_left_input"><input name="info[website]" type="text" class="txt" id="website" value="<?php echo $website?>"/></div><span id="validatewebsite" class="validate"></span><br/><br/>       
			<div class="txt_text_left">传真:</div>
			<div class="txt_left_input"><input name="info[fax]" type="text" class="txt" id="fax" value="<?php echo $fax?>"/></div><span id="validatefax" class="validate"></span><br/><br/> 
		</div>
		<div class="txt_txtarea">
			<div class="txt_txtarea_text">备注：</div>
			<div class="txt_txtarea_input1"><textarea name="info[remark]" cols="50" rows="4" class="txt_txtarea_font"><?php echo $remark?></textarea></div>
		</div>
	</div>
</div>

<div class="txt_btn">
	<input name="dosubmit" type="submit" class="txt_btn_a" value=" 保存 " />
</div>
</form>
</div>
</body>
<script type="text/javascript">
<!--
function customercheck(){
	$('#customer_name').blur(function(){
		var validate = $('#validatecustomer_name');
		if(isNotNull($(this).val())){	
			validate.html('');
			var t = this;		
			if(this.value != this.lastValue){
				if(this.timer){clearTimeout(this.timer);}
				validate.html('');
				validate.html('<img src="images/onLoad.gif" width=16 heigth=16>检测中');
				this.timer = setTimeout(function(){
					$.ajax({
						type : 'get',
						url:'',
						data:"m=account&c=customermanage&a=public_checkcustomername_ajx&customer_name="+t.value+"&y_customer_name="+$('#y_customer_name').val(),
						success : function(data){
							if(data == "0"){									
								validate.html('<img src="images/false.gif" width=16 heigth=16>客户已存在');										
							}else {	
								validate.html('<img src="images/true.gif" width=16 heigth=16>');		
							}	
						}
					});
				},200);
				this.lastValue = this.value;
			}
		} else {
			validate.html('<img src="images/false.gif" width=16 heigth=16>不能为空');	
		}
	});
	$('#email').blur(function(){
		var validateEmail = $('#validateemail');
		if(!is_email($(this).val())){
			validateEmail.html('<img src="images/false.gif" width=16 heigth=16>请输入正确的邮箱');	
		} else {
			validateEmail.html('<img src="images/true.gif" width=16 heigth=16>');		
		}
	});

	$('#phone').blur(function(){
		var validate = $('#validatephone');
		if(isNum($(this).val())){
			validate.html('<img src="images/true.gif" width=16 heigth=16>');
		} else {
			validate.html('<img src="images/false.gif" width=16 heigth=16>请输入正确的电话号码');
		}
	});
	$('#fax').blur(function(){
		var validate = $('#validatefax');
		if(isNum($(this).val())){
			validate.html('<img src="images/true.gif" width=16 heigth=16>');
		} else {
			validate.html('<img src="images/false.gif" width=16 heigth=16>请输入正确的传真号码');
		}
	});
}
//-->
</script>
</html>